home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / UTIL / TouchMe 1.1.1.sit / touchMe 1.11 Folder / scripts / sample 5 < prev    next >
Text File  |  1996-08-08  |  2KB  |  50 lines

  1. -- Sample AppleScripts for touchMe, 1996 (C) Mizutori Tetsuya
  2. -- A droplet to change the date time stamp of every file {in the given folder(s)}
  3. -- that copies its modification date to the creation date by file-by-file.
  4. -- How to compile this AppleScript: execute "Save As Run-Only..." command!
  5. -- Usage1: Run this droplet to select a target folder in the prompt dialog.
  6. -- Usage2: Drag & drop the target folders (or files) onto this droplet icon.
  7.  
  8. -- Thanks to Jim van Zee for encouraging me to write this wonderful script.
  9. -- He had some problems on using the Macintosh "tar" application to extract
  10. -- a tar file which was created on Unix machine. He found that the extracted
  11. -- files have their original time stamp as the modification date, whereas the 
  12. -- current time as its creation date. Wow, the file was created in the future!
  13. -- This sample script can correct the creation date by the modification date.
  14.  
  15.  
  16. tell me to open {(choose folder)}
  17. --tell me to open {(choose file)}
  18.  
  19. on open (docList)
  20.     tell application "touchMe"
  21.         activate
  22.         set prefs creation to {enabled:true, flag:exact}
  23.         set prefs modification to {enabled:false}
  24.     end tell
  25.     --
  26.     repeat with theItem in the docList
  27.         if the folder of (info for theItem) is true then
  28.             repeat with theFilename in the list folder theItem
  29.                 tell me to SetDateTimeStamp by (alias ((theItem as string) & theFilename))
  30.             end repeat
  31.         else
  32.             tell me to SetDateTimeStamp by theItem
  33.         end if
  34.     end repeat
  35.     --
  36.     tell application "touchMe"
  37.         quit
  38.     end tell
  39. end open
  40.  
  41. to SetDateTimeStamp by theFile
  42.     tell application "touchMe"
  43.         set theStamp to fetch theFile
  44.         -- set theDate to the creation date of theStamp
  45.         set theDate to the modification date of theStamp
  46.         set prefs creation to {value:theDate}
  47.         touch theFile
  48.     end tell
  49. end SetDateTimeStamp
  50.